package com.global.college.views;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.global.college.R;


public class SexChangeDialog extends Dialog implements View.OnClickListener {

    public Context context;
    public TextView tv_man, tv_woman, tv_scret;
    public LinearLayout ll_close;
    private int State = 1;
    private LayoutInflater inflater;


    public SexChangeDialog(Activity context, OnCallBack onCallBack) {
        super(context, R.style.dialog);
        this.context = context;
        mOnCallBack = onCallBack;
        this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View view = inflater.inflate(R.layout.sex_change_dialog, null);
        setContentView(view);

        initView(view);
        initData();
        setCanceledOnTouchOutside(false);
    }

    private void initView(View view) {
        tv_man = (TextView) view.findViewById(R.id.tv_man);
        tv_woman = (TextView) view.findViewById(R.id.tv_woman);
        tv_scret = (TextView) view.findViewById(R.id.tv_scret);
        ll_close = (LinearLayout) view.findViewById(R.id.ll_close);
    }

    private void initData() {
        tv_man.setOnClickListener(this);
        tv_woman.setOnClickListener(this);
        tv_scret.setOnClickListener(this);
        ll_close.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_man:
                if (null != mOnCallBack) {
                    mOnCallBack.callBack(0);
                    dismiss();
                }
                break;
            case R.id.tv_woman:
                if (null != mOnCallBack) {
                    mOnCallBack.callBack(1);
                    dismiss();
                }
                break;
            case R.id.tv_scret:
                if (null != mOnCallBack) {
                    mOnCallBack.callBack(2);
                    dismiss();
                }
                break;
            case R.id.ll_close:
                if (null != mOnCallBack) {
                    mOnCallBack.callBack(3);
                    dismiss();
                }
                break;

        }
    }

    public interface OnCallBack {
        void callBack(int param);
    }

    private OnCallBack mOnCallBack;




}
